package com.example.schedule.quartz.base;

import lombok.Data;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Trigger;

/**
 * @Description:
 * @Author: yangzhiwei
 * @Date: 2021/2/8 18:09
 */
@Data
public class MyJob implements Job {

    private String jb1;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("jb1 Quartz自动设置" + jb1);


        System.out.println(jobExecutionContext.getTrigger().getKey()); //key由组名 + 对象名表示
        Trigger trigger = jobExecutionContext.getTrigger();
        System.out.println("trigger t1Value:" + trigger.getJobDataMap().get("t1"));

        System.out.println("trigger t1Value:" + trigger.getJobDataMap().get("t2"));

       // JobDetail jobDetail =
        System.out.println("JobDetail" + jobExecutionContext.getJobDetail().getJobDataMap());
        System.out.println("Job1 t1Value:" + jobExecutionContext.getJobDetail().getJobDataMap().get("jb1"));
    }
}
